﻿@using FwProject.Web.Startup
@using Abp.Timing
@using Abp.Web.Mvc.Models
@using System.Security.Claims
@section styles{
    <style>
        .layui-form-group {
            margin: 15px 0;
        }

        .deploy-plus h2 {
            border-bottom: solid 1px #ececec;
            margin-bottom: 15px;
            padding: 5px 10px;
            font-size: 15px;
            color: #333;
            line-height: 2;
        }

        .hidden {
            display: none;
        }
    </style>
}
@{

    string realName = User.Identity.Name;
    string face = string.Empty;
    var user = (ClaimsIdentity)User.Identity;
    try
    {
        realName = user.FindFirst("Name").Value;
        face = user.FindFirst("Face").Value;
    }
    catch (Exception e)
    {
        realName = "admin";
        face = "~/Theme/img/DefaultFaces.jpg";
    }
}
<div class="layui-layout layui-layout-admin kit-layout-admin">
    <div class="layui-header">
        <div class="layui-logo">
            <span>饭碗易购商城管理</span>
        </div>
        <ul class="layui-nav layui-layout-left layui-nav-menu">
            <li class="layui-nav-item layadmin-flexible kit-side-fold">
                <a href="javascript:;" layadmin-event="flexible">
                    <i class="layui-icon layui-icon-shrink-right" id="LAY_app_flexible"></i>
                </a>
            </li>
            @*<li class="layui-nav-item layui-hide-xs">
                    <a href="" target="_blank">
                        <i class="layui-icon layui-icon-website"></i>
                    </a>
                </li>*@
            <li class="layui-nav-item layui-hide-xs">
                <a href="javascript:;" layadmin-event="refresh">
                    <i class="layui-icon layui-icon-refresh-3"></i>
                </a>
            </li>
        </ul>
        <ul class="layui-nav layui-layout-right" lay-filter="layadmin-layout-right">
            <li class="layui-nav-item">
          <a href="javascript:;">
            <i class="layui-icon"></i> 皮肤
          <span class="layui-nav-more"></span></a>
          <dl class="layui-nav-child skin layui-anim layui-anim-upbit">
            <dd class=""><a href="javascript:;" data-skin="default" style="color:#393D49;"><i class="layui-icon"></i> 默认</a></dd>
            <dd class=""><a href="javascript:;" data-skin="orange" style="color:#ff6700;"><i class="layui-icon"></i> 橘子橙</a></dd>
            <dd class=""><a href="javascript:;" data-skin="green" style="color:#00a65a;"><i class="layui-icon"></i> 原谅绿</a></dd>
            <dd class=""><a href="javascript:;" data-skin="pink" style="color:#FA6086;"><i class="layui-icon"></i> 少女粉</a></dd>
            <dd class=""><a href="javascript:;" data-skin="blue.1" style="color:#00c0ef;"><i class="layui-icon"></i> 天空蓝</a></dd>
            <dd class="layui-this"><a href="javascript:;" data-skin="red" style="color:#dd4b39;"><i class="layui-icon"></i> 枫叶红</a></dd>
          </dl>
        </li>
            <li class="layui-nav-item layui-hide-xs">
                <a lay-href="" layadmin-event="">
                    <i class="layui-icon layui-icon-notice"></i>
                    <span class="layui-badge-dot"></span>
                </a>
            </li>
            <li class="layui-nav-item layui-hide-xs">
                <a href="javascript:;" layadmin-event="note">
                    <i class="layui-icon layui-icon-note"></i>
                </a>
            </li>
            <li class="layui-nav-item">
                <a href="javascript:;"><img src="@Url.Content(string.IsNullOrEmpty(face)?"~/images/face.jpg":Url.Content(face))" class="layui-nav-img" />@realName</a>
                <dl class="layui-nav-child">
                    @*<dd><a href="">基本资料</a></dd>*@
                    <dd><a id="updatepwd">修改密码</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item">
                <a href="@Url.Action("Logout", "Account")">安全退出</a>
            </li>
        </ul>
    </div>
    <div class="layui-side layui-bg-black kit-side layui-side-menu">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree" id="side-menu" lay-filter="kitNavbar" kit-navbar>
                @await Component.InvokeAsync("NavMenu", new { activeMenu = "" })
            </ul>
        </div>
    </div>
    <div class="layui-body" id="container">
        <!-- 内容主体区域 -->
        <div style="padding: 15px;">主体内容加载中,请稍等...</div>
    </div>
</div>
<div id="modal_change_password" class="deploy-plus" @*style="padding:15px" *@>
    @*@{Html.RenderPartial("../Account/ChangePasswordPartial");}*@
</div>
@section scripts{
    @*<script src="~/Scripts/jquery.signalR-2.2.1.min.js"></script>
        <script src="~/Abp/Framework/scripts/libs/abp.signalr.js"></script>
        <script src="/signalr/hubs"></script>*@

    <script type="text/javascript">
        var message;
        layui.config({
            base: 'plugins/build/js/'
        }).use(['app', 'message'], function () {
            var layer = layui.layer,
                app = layui.app,
                $ = layui.jquery;
            //将message设置为全局以便子页面调用
            message = layui.message;
            //主入口
            app.set({
                type: 'iframe'
            }).init();

            $('dl.skin > dd').on('click', function () {
                var $that = $(this);
                var skin = $that.children('a').data('skin');
                switchSkin(skin);
            });
            var setSkin = function (value) {
                layui.data('kit_skin', {
                    key: 'skin',
                    value: value
                });
            },
                getSkinName = function () {
                    return layui.data('kit_skin').skin;
                },
                switchSkin = function (value) {
                    var _target = $('link[kit-skin]')[0];
                    _target.href = _target.href.substring(0, _target.href.lastIndexOf('/') + 1) + value + _target.href.substring(_target.href.lastIndexOf('.'));
                    setSkin(value);

                },
                initSkin = function () {
                    var skin = getSkinName();
                    switchSkin(skin === undefined ? 'default' : skin);
                }();
        });

        $(".laydate-theme-grid>a").on("click", function () {

            $(this).parent(".laydate-theme-grid").toggleClass("active").siblings().removeClass("active")
        })

        $('#updatepwd').on('click', function () {
            layer.open({
                type: 1,
                shadeClose: true,
                title: false,
                closeBtn: 1,
                scrollbar: false,
                content: $("#modal_change_password"),
                area: "600px",
                success: function (layero, index) {
                    $(".layui-btn-reset").click(function () {
                        layer.close(index)
                    })
                }
            })
        })



        $(document).ready(function () {
            $('#modal_change_password').on('hidden.bs.modal', function (e) {
                var $form = $(this).find("form");
                if ($form)
                    $form[0].reset();
            });
            layer.closeAll('loading');
        });

        function openTab(idx, title, url) {
            var $sb = $('<li  class="layui-nav-item"><a href="javascript:;" kit-target data-options="'+"{url:'"+url+"',icon:'"+"&#xe658;"+"',title:'"+title+"',id:'"+idx+"'}"+'"><i class="layui-icon">&#xe658;</i><span>' + title + '</span></a></li>').appendTo($("#side-menu"));
            //var $sb = $('<li class="hidden"><a class="J_menuItem" href="' + url + '" data-index="' + idx + '"><i class="fa fa-file-text-o"></i><span class="nav-label">' + title + '</span></a></li>').appendTo($("#side-menu"/*, top.window.document*/));
            $sb.children("a").get(0).click();
            $sb.remove();
        }

        function NewTab(idx, title, url) {
            tab.tabAdd({
                icon: 'fa-user',
                id: idx,
                title: title,
                url: url
            });
        }


        function CloseTab(tabid) {
            var li = $('.layui-body .layui-tab-title').find("li[lay-id='" + tabid + "']");
            li.find('i.layui-tab-close').click();
        }
    </script>
}
